home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / aplictns / xscheme2 / part01 next >
Encoding:
Internet Message Format  |  1990-04-14  |  59.1 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i139: XScheme 0.20 - an object-oriented scheme, Part01/07
  5. Message-ID: <12209@xanth.cs.odu.edu>
  6. Date: 14 Apr 90 21:08:00 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: rusty@fe2o3.UUCP (Rusty Haddock)
  9. Lines: 2267
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11. X-Mail-Submissions-To: Amiga@cs.odu.edu
  12. X-Post-Discussions-To: comp.sys.amiga
  13.  
  14. Submitted-by: rusty@fe2o3.UUCP (Rusty Haddock)
  15. Posting-number: Volume 90, Issue 139
  16. Archive-name: applications/xscheme-0.20/part01
  17.  
  18. [ This is what's available via anonymous ftp from uunet.uu.net.  ...tad ]
  19.  
  20. This is David Betz's XScheme 0.20 (yes, not even 1.0 yet) with my
  21. Amiga/Manx modifications.
  22.  
  23. Enjoy!
  24.         -Rusty-
  25.  
  26. #!/bin/sh
  27. # This is a shell archive.  Remove anything before this line, then unpack
  28. # it by saving it into a file and typing "sh file".  To overwrite existing
  29. # files, type "sh file -c".  You can also feed this as standard input via
  30. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  31. # will see the following message at the end:
  32. #        "End of archive 1 (of 7)."
  33. # Contents:  README.mwh2 Src Src/Makefile Src/amistuff.c Src/unixstuf.c
  34. #   Src/xsbcode.h Src/xscheme.c Src/xsinit.c Src/xsio.c Src/xsprint.c
  35. #   Src/xssym.c david.betz histogram.s macros.s mystuff.s.uu pi-calc.s
  36. #   qquote.s xscheme.ini
  37. # Wrapped by tadguy@xanth on Sat Apr 14 17:07:19 1990
  38. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  39. if test -f 'README.mwh2' -a "${1}" != "-c" ; then 
  40.   echo shar: Will not clobber existing file \"'README.mwh2'\"
  41. else
  42. echo shar: Extracting \"'README.mwh2'\" \(2910 characters\)
  43. sed "s/^X//" >'README.mwh2' <<'END_OF_FILE'
  44. XHi there fellow Amiga Schemers!
  45. X
  46. X   Here is the XScheme I downloaded from the MIPS Magazine's BBS.  I got
  47. Xamistuff.c from XLisp2.0's amigastuff.c file.  About the only changes I
  48. Xmade here involved changing MS-DOS's EOF character from ^Z (control-Z)
  49. Xto the Amiga's ^\ (control-\) and changing the tab stops from every
  50. Xeight columns to every four. 
  51. X
  52. X   I also modified what was needed to get this version (0.20) of XScheme
  53. Xto compile under Manx 3.6.  The makefile is intended for Manx's Make
  54. Xprogram although it's simple enough that almost any make in the world
  55. Xcould use it. 
  56. X   
  57. X   Here are some problems that I've encountered so far:
  58. X
  59. X   The first one looks like some kind of unsigned/signed extension
  60. Xproblem with the 68000 byte-ordering.  Remember, XScheme was originally
  61. Xwritten for 80x86 which has a different byte-ordering. 
  62. X
  63. X1]    > (list->string '(#\A #\b #\C #\?))
  64. X    "AbC\37777777662"    but it should produce "AbC?"
  65. X
  66. X    > #\?
  67. X    #\?
  68. X
  69. X    >
  70. X
  71. X2]    (transcript-on "file.nam")  doesn't work!!!
  72. X
  73. X3]    Not a problem with XScheme itself but the some of the bogus
  74. X    '881 assembler code generated by the Manx C compiler.
  75. X    If you use the -A option (don't assemble) when compiling
  76. X    XSMATH.C then you'll get the assembler output from the C
  77. X    compiler.  It is this that you can edit manually and assemble
  78. X    after changing the following lines according to the sample
  79. X    change given thereafter.
  80. X
  81. X    Aztec 68000 Assembler 3.6a  12-18-87
  82. X        sin.l    d0
  83. X        ^
  84. X    File xsmath.s; Line 1571 # Unknown opcode or directive.
  85. X        cos.l    d0
  86. X        ^
  87. X    File xsmath.s; Line 1583 # Unknown opcode or directive.
  88. X        tan.l    d0
  89. X        ^
  90. X    File xsmath.s; Line 1591 # Unknown opcode or directive.
  91. X        asin.l    d0
  92. X        ^
  93. X    File xsmath.s; Line 1599 # Unknown opcode or directive.
  94. X        acos.l    d0
  95. X        ^
  96. X    File xsmath.s; Line 1607 # Unknown opcode or directive.
  97. X        atan.l    d0
  98. X        ^
  99. X    File xsmath.s; Line 1615 # Unknown opcode or directive.
  100. X        etox.l    d0
  101. X        ^
  102. X    File xsmath.s; Line 1623 # Unknown opcode or directive.
  103. X        logn.l    d0
  104. X        ^
  105. X    File xsmath.s; Line 1631 # Unknown opcode or directive.
  106. X        sqrt.l    d0
  107. X        ^
  108. X    File xsmath.s; Line 1642 # Unknown opcode or directive.
  109. X    9 errors
  110. X
  111. X
  112. X    Around the aforementioned errors you'll see code something
  113. X    like this:
  114. X
  115. X        move.l    -12(a5),d0
  116. X        sin.l    d0
  117. X        fmove.l    d0,fp0
  118. X
  119. X    Change that to this:
  120. X
  121. X        fsin.l    -12(a5),fp0
  122. X
  123. X
  124. X    Heck, I'll tell you what... I'll include an '881 version of XScheme
  125. Xalong with the assembly language source code PLUS I'll even give you the
  126. Xpatched assembler output.  Naturally, this is for you folks with an
  127. X68020/'881 combination.  How's that for service? :-)
  128. X
  129. X4]  Remember to set the system stack to something appropriate.  I was
  130. X    running into problems with munching lists of 360 floats and my stack
  131. X    was set at 20000.   Enlarging it to 65000 ``seemed'' to fix my
  132. X    problems.
  133. X
  134. X
  135. X
  136. X
  137. X          Rusty Haddock
  138. X    US Snail: 8719 Contee Rd.  Apt. #103
  139. X          Laurel, Maryland
  140. X          USA   20708-1907
  141. X
  142. X    USENET:   uunet!mimsy!fe2o3!rusty
  143. X    INTERNET: rusty%fe2o3@mimsy.umd.edu
  144. END_OF_FILE
  145. if test 2910 -ne `wc -c <'README.mwh2'`; then
  146.     echo shar: \"'README.mwh2'\" unpacked with wrong size!
  147. fi
  148. # end of 'README.mwh2'
  149. fi
  150. if test ! -d 'Src' ; then
  151.     echo shar: Creating directory \"'Src'\"
  152.     mkdir 'Src'
  153. fi
  154. if test -f 'Src/Makefile' -a "${1}" != "-c" ; then 
  155.   echo shar: Will not clobber existing file \"'Src/Makefile'\"
  156. else
  157. echo shar: Extracting \"'Src/Makefile'\" \(1463 characters\)
  158. sed "s/^X//" >'Src/Makefile' <<'END_OF_FILE'
  159. X# Makefile for XScheme Amiga/Manx version 0.20
  160. X# This version of Makefile by Rusty Haddock (rusty%fe2o3@mimsy.umd.edu)
  161. X# February 5, 1990
  162. X
  163. XOBJ1=xscheme.o xsdmem.o xsftab.o xsimage.o xsio.o xsobj.o \
  164. Xxsprint.o xsread.o xssym.o xsfun1.o xsfun2.o amistuff.o
  165. X# unixstuf.o msstuff.o
  166. X
  167. XOBJ2=xsinit.o xscom.o xsint.o
  168. XOBJM=xsmath.o
  169. X
  170. X# ----------------------------------------------------
  171. X
  172. X# +fi for "new" 1.2.1 Amiga IEEE Double Precision math & transcendental libs
  173. X# FPFORMAT=+fi
  174. X
  175. X# +f8 for inline 68881 FPU code -- *BUT* Manx 3.6 produces bad opcodes
  176. X# for xsmath.c!  If the assembler output is saved it's rather trivial
  177. X# to edit and run through the assembler.  See the file "README.MWH2".
  178. XFPFORMAT=+f8
  179. X
  180. X# FPLIB=mtl32
  181. XFPLIB=m8l32
  182. X
  183. X# ----------------------------------------------------
  184. X
  185. X# +P => Large data & code, 32-bit ints
  186. X# +m => stack checking
  187. X# -Z4096 => Use a literal table having 4K bytes
  188. X# -E256  => Use an expression table having 256 entries
  189. XCFLAGS=+P -Z4096 -E256 $(FPFORMAT) +m
  190. X
  191. X# -C => Use large CODE memory model with assembler
  192. X# -D => Use large DATA memory model with assembler
  193. XAFLAGS=-C -D
  194. X
  195. X# ----------------------------------------------------
  196. X
  197. Xxscheme:    $(OBJ1) $(OBJ2) $(OBJM)
  198. X    ln -o xscheme $(OBJ1) $(OBJ2) $(OBJM) -l$(FPLIB) -lcl32
  199. X
  200. X$(OBJ1):    xscheme.h
  201. X$(OBJ2):    xscheme.h xsbcode.h
  202. X
  203. X# Uncomment for IEEE library math functions
  204. X# $(OBJM):    xsmath.c xscheme.h
  205. X
  206. X# Uncomment for 68881 inline code
  207. X$(OBJM):    xscheme.h
  208. X    as $(AFLAGS) -o xsmath.o xsmath881.s
  209. END_OF_FILE
  210. if test 1463 -ne `wc -c <'Src/Makefile'`; then
  211.     echo shar: \"'Src/Makefile'\" unpacked with wrong size!
  212. fi
  213. # end of 'Src/Makefile'
  214. fi
  215. if test -f 'Src/amistuff.c' -a "${1}" != "-c" ; then 
  216.   echo shar: Will not clobber existing file \"'Src/amistuff.c'\"
  217. else
  218. echo shar: Extracting \"'Src/amistuff.c'\" \(5953 characters\)
  219. sed "s/^X//" >'Src/amistuff.c' <<'END_OF_FILE'
  220. X/* amistuff.c - amiga specific routines */
  221. X/* A good portion of this file (mostly all of it) came from XLisp 2.0.  */
  222. X#include "xscheme.h"
  223. X
  224. X#define LBSIZE 200
  225. X
  226. X/* external variables */
  227. Xextern LVAL s_unbound,true;
  228. Xextern FILE *tfp;
  229. Xextern int errno;
  230. X
  231. X/* local variables */
  232. Xstatic long wfd;
  233. Xstatic char lbuf[LBSIZE];
  234. Xstatic int lpos[LBSIZE];
  235. Xstatic int lindex;
  236. Xstatic int lcount;
  237. Xstatic int lposition;
  238. Xstatic long rseed = 1L;
  239. X
  240. X/* external routines */
  241. Xextern long Open();
  242. Xextern long WaitForChar();
  243. Xextern long Execute();
  244. X
  245. X/* osinit - initialize */
  246. Xosinit(banner)
  247. X  char *banner;
  248. X{
  249. X    wfd = Open("RAW:0/0/640/200/XScheme Version 0.20, by David Betz",1006L);
  250. X    if (wfd == 0L)
  251. X    exit(1);
  252. X    while (*banner)
  253. X    xputc(*banner++);
  254. X    xputc('\r'); xputc('\n');
  255. X    lposition = 0;
  256. X    lindex = 0;
  257. X    lcount = 0;
  258. X}
  259. X
  260. X/* osfinish - clean up before returning to the operating system */
  261. Xosfinish()
  262. X{
  263. X    Close(wfd);
  264. X}
  265. X
  266. X/* oserror - print an error message */
  267. Xoserror(msg)
  268. X  char *msg;
  269. X{
  270. X    char buf[100],*p;
  271. X    sprintf("error: %s\n",msg);
  272. X    for (p = buf; *p; )
  273. X    xputc(*p++);
  274. X}
  275. X
  276. X/* osrand - return a random number between 0 and n-1 */
  277. Xint osrand(n)
  278. X  int n;
  279. X{
  280. X    long k1;
  281. X
  282. X    /* make sure we don't get stuck at zero */
  283. X    if (rseed == 0L) rseed = 1L;
  284. X
  285. X    /* algorithm taken from Dr. Dobbs Journal, November 1985, page 91 */
  286. X    k1 = rseed / 127773L;
  287. X    if ((rseed = 16807L * (rseed - k1 * 127773L) - k1 * 2836L) < 0L)
  288. X    rseed += 2147483647L;
  289. X
  290. X    /* return a random number between 0 and n-1 */
  291. X    return ((int)(rseed % (long)n));
  292. X}
  293. X
  294. X/* osaopen - open an ascii file */
  295. XFILE *osaopen(name,mode)
  296. X  char *name,*mode;
  297. X{
  298. X    return (fopen(name,mode));
  299. X}
  300. X
  301. X/* osbopen - open a binary file */
  302. XFILE *osbopen(name,mode)
  303. X  char *name,*mode;
  304. X{
  305. X    return (fopen(name,mode));
  306. X}
  307. X
  308. X/* osclose - close a file */
  309. Xint osclose(fp)
  310. X  FILE *fp;
  311. X{
  312. X    return (fclose(fp));
  313. X}
  314. X
  315. X/* ostell - get the current file position */
  316. Xlong ostell(fp)
  317. X  FILE *fp;
  318. X{
  319. X    return (ftell(fp));
  320. X}
  321. X
  322. X/* osseek - set the current file position */
  323. Xint osseek(fp,offset,whence)
  324. X  FILE *fp; long offset; int whence;
  325. X{
  326. X    return (fseek(fp,offset,whence));
  327. X}
  328. X
  329. X/* osagetc - get a character from an ascii file */
  330. Xint osagetc(fp)
  331. X  FILE *fp;
  332. X{
  333. X    return (agetc(fp));
  334. X}
  335. X
  336. X/* osaputc - put a character to an ascii file */
  337. Xint osaputc(ch,fp)
  338. X  int ch; FILE *fp;
  339. X{
  340. X    return (aputc(ch,fp));
  341. X}
  342. X
  343. X/* osbgetc - get a character from a binary file */
  344. Xint osbgetc(fp)
  345. X  FILE *fp;
  346. X{
  347. X    return (getc(fp));
  348. X}
  349. X
  350. X/* osbputc - put a character to a binary file */
  351. Xint osbputc(ch,fp)
  352. X  int ch; FILE *fp;
  353. X{
  354. X    return (putc(ch,fp));
  355. X}
  356. X
  357. X/* ostgetc - get a character from the terminal */
  358. Xint ostgetc()
  359. X{
  360. X    int ch;
  361. X
  362. X    /* check for a buffered character */
  363. X    if (lcount--)
  364. X    return (lbuf[lindex++]);
  365. X
  366. X    /* get an input line */
  367. X    for (lcount = 0; ; )
  368. X    switch (ch = xgetc()) {
  369. X    case '\r':
  370. X        lbuf[lcount++] = '\n';
  371. X        xputc('\r'); xputc('\n'); lposition = 0;
  372. X        if (tfp)
  373. X            for (lindex = 0; lindex < lcount; ++lindex)
  374. X            osaputc(lbuf[lindex],tfp);
  375. X        lindex = 0; lcount--;
  376. X        return (lbuf[lindex++]);
  377. X    case '\010':
  378. X    case '\177':
  379. X        if (lcount) {
  380. X            lcount--;
  381. X            while (lposition > lpos[lcount]) {
  382. X            xputc('\010'); xputc(' '); xputc('\010');
  383. X            lposition--;
  384. X            }
  385. X        }
  386. X        break;
  387. X    case '\034':        /* Amiga's natural EOF */
  388. X                /* MS-DOS CTRL-Z EOF case '\032': */
  389. X        xflush();
  390. X        return (EOF);
  391. X    default:
  392. X        if (ch == '\t' || (ch >= 0x20 && ch < 0x7F)) {
  393. X            lbuf[lcount] = ch;
  394. X            lpos[lcount] = lposition;
  395. X            if (ch == '\t')
  396. X            do {
  397. X                xputc(' ');
  398. X            } while (++lposition & 3); /* This was 7 but I
  399. X                              like tabs every 4.*/
  400. X            else {
  401. X            xputc(ch); lposition++;
  402. X            }
  403. X            lcount++;
  404. X        }
  405. X        else {
  406. X            xflush();
  407. X            switch (ch) {
  408. X            case '\003':    xltoplevel();    /* control-c */
  409. X            case '\007':    xlcleanup();    /* control-g */
  410. X            case '\020':    xlcontinue();    /* control-p */
  411. X/*            case '\032':    return (EOF);     * control-z */
  412. X            case '\034':    return (EOF);    /* control-\ */
  413. X            default:        return (ch);
  414. X            }
  415. X        }
  416. X    }
  417. X}
  418. X
  419. X/* ostputc - put a character to the terminal */
  420. Xostputc(ch)
  421. X  int ch;
  422. X{
  423. X    /* check for control characters */
  424. X    oscheck();
  425. X
  426. X    /* output the character */
  427. X    if (ch == '\n') {
  428. X    xputc('\r'); xputc('\n');
  429. X    lposition = 0;
  430. X    }
  431. X    else {
  432. X    xputc(ch);
  433. X    lposition++;
  434. X   }
  435. X
  436. X   /* output the character to the transcript file */
  437. X   if (tfp)
  438. X    osaputc(ch,tfp);
  439. X}
  440. X
  441. X/* osflush - flush the terminal input buffer */
  442. Xosflush()
  443. X{
  444. X    lindex = lcount = lposition = 0;
  445. X}
  446. X
  447. X/* oscheck - check for control characters during execution */
  448. Xoscheck()
  449. X{
  450. X    int ch;
  451. X    if (ch = xcheck())
  452. X    switch (ch) {
  453. X    case '\002':    /* control-b */
  454. X        xflush();
  455. X        xlbreak("BREAK",s_unbound);
  456. X        break;
  457. X    case '\003':    /* control-c */
  458. X        xflush();
  459. X        xltoplevel();
  460. X        break;
  461. X    case '\024':    /* control-t */
  462. X        xinfo();
  463. X        break;
  464. X    }
  465. X}
  466. X
  467. X/* xinfo - show information on control-t */
  468. Xstatic xinfo()
  469. X{
  470. X    extern int nfree,gccalls;
  471. X    extern long total;
  472. X    char buf[80];
  473. X    sprintf(buf,"\n[ Free: %d, GC calls: %d, Total: %ld ]",
  474. X        nfree,gccalls,total);
  475. X    errputstr(buf);
  476. X}
  477. X
  478. X/* xflush - flush the input line buffer and start a new line */
  479. Xstatic xflush()
  480. X{
  481. X    osflush();
  482. X    ostputc('\n');
  483. X}
  484. X
  485. X/* xgetc - get a character from the terminal without echo */
  486. Xstatic int xgetc()
  487. X{
  488. X    unsigned char buf;
  489. X    Read(wfd,&buf,1L);
  490. X    return (buf);
  491. X}
  492. X
  493. X/* xputc - put a character to the terminal */
  494. Xstatic xputc(ch)
  495. X  int ch;
  496. X{
  497. X    unsigned char buf;
  498. X    buf = ch;
  499. X    Write(wfd,&buf,1L);
  500. X}
  501. X
  502. X/* xcheck - check for a character */
  503. Xstatic int xcheck()
  504. X{
  505. X    if (WaitForChar(wfd,0L) == 0L)
  506. X    return (0);
  507. X    return (xgetc());
  508. X}
  509. X
  510. X/* xsystem - execute a system command */
  511. XLVAL xsystem()
  512. X{
  513. X    unsigned char *cmd;
  514. X    cmd = getstring(xlgastring());
  515. X    xllastarg();
  516. X    return (Execute(cmd,0L,wfd) == -1 ? cvfixnum((FIXTYPE)errno) : true);
  517. X}
  518. X
  519. X/* xgetkey - get a key from the keyboard */
  520. XLVAL xgetkey()
  521. X{
  522. X    xllastarg();
  523. X    return (cvfixnum((FIXTYPE)xgetc()));
  524. X}
  525. X
  526. X/* ossymbols - enter os specific symbols */
  527. Xossymbols()
  528. X{
  529. X}
  530. END_OF_FILE
  531. if test 5953 -ne `wc -c <'Src/amistuff.c'`; then
  532.     echo shar: \"'Src/amistuff.c'\" unpacked with wrong size!
  533. fi
  534. # end of 'Src/amistuff.c'
  535. fi
  536. if test -f 'Src/unixstuf.c' -a "${1}" != "-c" ; then 
  537.   echo shar: Will not clobber existing file \"'Src/unixstuf.c'\"
  538. else
  539. echo shar: Extracting \"'Src/unixstuf.c'\" \(3218 characters\)
  540. sed "s/^X//" >'Src/unixstuf.c' <<'END_OF_FILE'
  541. X/* unixstuff.c - unix specific routines */
  542. X
  543. X#include "xscheme.h"
  544. X
  545. X#define LBSIZE 200
  546. X
  547. X/* external variables */
  548. Xextern LVAL s_unbound,true;
  549. Xextern FILE *tfp;
  550. Xextern int errno;
  551. X
  552. X/* local variables */
  553. Xstatic char lbuf[LBSIZE];
  554. Xstatic int lindex;
  555. Xstatic int lcount;
  556. Xstatic long rseed = 1L;
  557. X
  558. X/* osinit - initialize */
  559. Xosinit(banner)
  560. X  char *banner;
  561. X{
  562. X    printf("%s\n",banner);
  563. X    lindex = 0;
  564. X    lcount = 0;
  565. X}
  566. X
  567. X/* osfinish - clean up before returning to the operating system */
  568. Xosfinish()
  569. X{
  570. X}
  571. X
  572. X/* oserror - print an error message */
  573. Xoserror(msg)
  574. X  char *msg;
  575. X{
  576. X    printf("error: %s\n",msg);
  577. X}
  578. X
  579. X/* osrand - return a random number between 0 and n-1 */
  580. Xint osrand(n)
  581. X  int n;
  582. X{
  583. X    long k1;
  584. X
  585. X    /* make sure we don't get stuck at zero */
  586. X    if (rseed == 0L) rseed = 1L;
  587. X
  588. X    /* algorithm taken from Dr. Dobbs Journal, November 1985, page 91 */
  589. X    k1 = rseed / 127773L;
  590. X    if ((rseed = 16807L * (rseed - k1 * 127773L) - k1 * 2836L) < 0L)
  591. X    rseed += 2147483647L;
  592. X
  593. X    /* return a random number between 0 and n-1 */
  594. X    return ((int)(rseed % (long)n));
  595. X}
  596. X
  597. X/* osaopen - open an ascii file */
  598. XFILE *osaopen(name,mode)
  599. X  char *name,*mode;
  600. X{
  601. X    return (fopen(name,mode));
  602. X}
  603. X
  604. X/* osbopen - open a binary file */
  605. XFILE *osbopen(name,mode)
  606. X  char *name,*mode;
  607. X{
  608. X    return (fopen(name,mode));
  609. X}
  610. X
  611. X/* osclose - close a file */
  612. Xint osclose(fp)
  613. X  FILE *fp;
  614. X{
  615. X    return (fclose(fp));
  616. X}
  617. X
  618. X/* ostell - get the current file position */
  619. Xlong ostell(fp)
  620. X  FILE *fp;
  621. X{
  622. X    return (ftell(fp));
  623. X}
  624. X
  625. X/* osseek - set the current file position */
  626. Xint osseek(fp,offset,whence)
  627. X  FILE *fp; long offset; int whence;
  628. X{
  629. X    return (fseek(fp,offset,whence));
  630. X}
  631. X
  632. X/* osagetc - get a character from an ascii file */
  633. Xint osagetc(fp)
  634. X  FILE *fp;
  635. X{
  636. X    return (getc(fp));
  637. X}
  638. X
  639. X/* osaputc - put a character to an ascii file */
  640. Xint osaputc(ch,fp)
  641. X  int ch; FILE *fp;
  642. X{
  643. X    return (putc(ch,fp));
  644. X}
  645. X
  646. X/* osbgetc - get a character from a binary file */
  647. Xint osbgetc(fp)
  648. X  FILE *fp;
  649. X{
  650. X    return (getc(fp));
  651. X}
  652. X
  653. X/* osbputc - put a character to a binary file */
  654. Xint osbputc(ch,fp)
  655. X  int ch; FILE *fp;
  656. X{
  657. X    return (putc(ch,fp));
  658. X}
  659. X
  660. X/* ostgetc - get a character from the terminal */
  661. Xint ostgetc()
  662. X{
  663. X    /* check for a buffered character */
  664. X    if (lcount--)
  665. X    return (lbuf[lindex++]);
  666. X
  667. X    /* get an input line */
  668. X    do {
  669. X    fgets(lbuf,LBSIZE,stdin);
  670. X    } while ((lcount = strlen(lbuf)) == 0);
  671. X
  672. X    /* write it to the transcript file */
  673. X    if (tfp)
  674. X    for (lindex = 0; lindex < lcount; ++lindex)
  675. X        osaputc(lbuf[lindex],tfp);
  676. X    lindex = 0; lcount--;
  677. X
  678. X    /* return the first character */
  679. X    return (lbuf[lindex++]);
  680. X}
  681. X
  682. X/* ostputc - put a character to the terminal */
  683. Xostputc(ch)
  684. X  int ch;
  685. X{
  686. X    /* check for control characters */
  687. X    oscheck();
  688. X
  689. X    /* output the character */
  690. X    putchar(ch);
  691. X
  692. X    /* output the character to the transcript file */
  693. X    if (tfp)
  694. X    osaputc(ch,tfp);
  695. X}
  696. X
  697. X/* osflush - flush the terminal input buffer */
  698. Xosflush()
  699. X{
  700. X    lindex = lcount = 0;
  701. X}
  702. X
  703. X/* oscheck - check for control characters during execution */
  704. Xoscheck()
  705. X{
  706. X}
  707. X
  708. X/* xsystem - execute a system command */
  709. XLVAL xsystem()
  710. X{
  711. X    char *cmd="sh";
  712. X    if (moreargs())
  713. X    cmd = (char *)getstring(xlgastring());
  714. X    xllastarg();
  715. X    return (system(cmd) == 0 ? true : cvfixnum((FIXTYPE)errno));
  716. X}
  717. END_OF_FILE
  718. if test 3218 -ne `wc -c <'Src/unixstuf.c'`; then
  719.     echo shar: \"'Src/unixstuf.c'\" unpacked with wrong size!
  720. fi
  721. # end of 'Src/unixstuf.c'
  722. fi
  723. if test -f 'Src/xsbcode.h' -a "${1}" != "-c" ; then 
  724.   echo shar: Will not clobber existing file \"'Src/xsbcode.h'\"
  725. else
  726. echo shar: Extracting \"'Src/xsbcode.h'\" \(2118 characters\)
  727. sed "s/^X//" >'Src/xsbcode.h' <<'END_OF_FILE'
  728. X/* xsbcode.h - xscheme compiler byte code definitions */
  729. X/*    Copyright (c) 1988, by David Michael Betz
  730. X    All Rights Reserved
  731. X    Permission is granted for unrestricted non-commercial use    */
  732. X
  733. X#define OP_BRT        0x01    /* branch on true */
  734. X#define OP_BRF        0x02    /* branch on false */
  735. X#define OP_BR        0x03    /* branch unconditionally */
  736. X#define OP_LIT        0x04    /* load literal */
  737. X#define OP_GREF        0x05    /* global symbol value */
  738. X#define OP_GSET        0x06    /* set global symbol value */
  739. X#define OP_EREF        0x09    /* environment variable value */
  740. X#define OP_ESET        0x0A    /* set environment variable value */
  741. X#define OP_SAVE        0x0B    /* save a continuation */
  742. X#define OP_CALL        0x0C    /* call a function */
  743. X#define OP_RETURN    0x0D    /* return from a function */
  744. X#define OP_T        0x0E    /* load 'val' with t */
  745. X#define OP_NIL        0x0F    /* load 'val' with nil */
  746. X#define OP_PUSH        0x10    /* push the 'val' register */
  747. X#define OP_CLOSE    0x11    /* create a closure */
  748. X
  749. X#define OP_FRAME    0x12    /* create a new enviroment frame */
  750. X#define OP_MVARG    0x13    /* move required argument to frame slot */
  751. X#define OP_MVOARG    0x14    /* move optional argument to frame slot */
  752. X#define OP_MVRARG    0x15    /* build rest argument and move to frame slot */
  753. X#define OP_ADROP    0x19    /* drop the rest of the arguments */
  754. X#define OP_ALAST    0x1A    /* make sure there are no more arguments */
  755. X#define OP_DELAY    0x1B    /* create a promise */
  756. X
  757. X#define OP_AREF        0x1C    /* access a variable in an environment */
  758. X#define OP_ASET        0x1D    /* set a variable in an environment */
  759. X
  760. X#define OP_ATOM        0x1E    /* atom predicate */
  761. X#define OP_EQ        0x1F    /* eq? predicate */
  762. X#define OP_NULL        0x20    /* null? (or not) predicate */
  763. X#define OP_CONS        0x21    /* cons */
  764. X#define OP_CAR        0x22    /* car */
  765. X#define OP_CDR        0x23    /* cdr */
  766. X#define OP_SETCAR    0x24    /* set-car! */
  767. X#define OP_SETCDR    0x25    /* set-cdr! */
  768. X
  769. X#define OP_ADD        0x40    /* add two numeric expressions */
  770. X#define OP_SUB        0x41    /* subtract two numeric expressions */
  771. X#define OP_MUL        0x42    /* multiply two numeric expressions */
  772. X#define OP_QUO        0x43    /* divide two integer expressions */
  773. X#define OP_LSS        0x44    /* less than */
  774. X#define OP_EQL        0x45    /* equal to */
  775. X#define OP_GTR        0x46    /* greater than */
  776. END_OF_FILE
  777. if test 2118 -ne `wc -c <'Src/xsbcode.h'`; then
  778.     echo shar: \"'Src/xsbcode.h'\" unpacked with wrong size!
  779. fi
  780. # end of 'Src/xsbcode.h'
  781. fi
  782. if test -f 'Src/xscheme.c' -a "${1}" != "-c" ; then 
  783.   echo shar: Will not clobber existing file \"'Src/xscheme.c'\"
  784. else
  785. echo shar: Extracting \"'Src/xscheme.c'\" \(3864 characters\)
  786. sed "s/^X//" >'Src/xscheme.c' <<'END_OF_FILE'
  787. X/* xscheme.c - xscheme main routine */
  788. X/*    Copyright (c) 1988, by David Michael Betz
  789. X    All Rights Reserved
  790. X    Permission is granted for unrestricted non-commercial use    */
  791. X
  792. X#include "xscheme.h"
  793. X
  794. X/* the program banner */
  795. X#define BANNER    "XScheme - Version 0.20 - Amiga/Manx"
  796. X
  797. X/* global variables */
  798. Xjmp_buf top_level;
  799. Xint clargc;    /* command line argument count */
  800. Xchar **clargv;    /* array of command line arguments */
  801. X
  802. X/* trace file pointer */
  803. XFILE *tfp=NULL;
  804. X
  805. X/* external variables */
  806. Xextern LVAL xlfun,xlenv,xlval;
  807. Xextern LVAL s_stdin,s_stdout,s_stderr,s_unbound;
  808. Xextern int trace;
  809. X
  810. X/* main - the main routine */
  811. Xmain(argc,argv)
  812. X  int argc; char *argv[];
  813. X{
  814. X    int src,dst;
  815. X    LVAL code;
  816. X    char *p;
  817. X    
  818. X    /* process the arguments */
  819. X    for (src = dst = 1, clargv = argv, clargc = 1; src < argc; ++src) {
  820. X
  821. X    /* handle options */
  822. X    if (argv[src][0] == '-') {
  823. X        for (p = &argv[src][1]; *p != '\0'; )
  824. X            switch (*p++) {
  825. X        case 't':        /* root directory */
  826. X            trace = TRUE;
  827. X            break;
  828. X        default:
  829. X                usage();
  830. X        }
  831. X    }
  832. X
  833. X    /* handle a filename */
  834. X    else {
  835. X        argv[dst++] = argv[src];
  836. X        ++clargc;
  837. X    }
  838. X    }
  839. X
  840. X    /* setup an initialization error handler */
  841. X    if (setjmp(top_level))
  842. X    exit(1);
  843. X
  844. X    /* initialize */
  845. X    osinit(BANNER);
  846. X    
  847. X    /* restore the default workspace, otherwise create a new one */
  848. X    if (!xlirestore("xscheme.wks"))
  849. X    xlinitws(5000);
  850. X
  851. X    /* do the initialization code first */
  852. X    code = xlenter("*INITIALIZE*");
  853. X    code = (boundp(code) ? getvalue(code) : NIL);
  854. X
  855. X    /* trap errors */
  856. X    if (setjmp(top_level)) {
  857. X    code = xlenter("*TOPLEVEL*");
  858. X    code = (boundp(code) ? getvalue(code) : NIL);
  859. X    xlfun = xlenv = xlval = NIL;
  860. X    xlsp = xlstktop;
  861. X    }
  862. X
  863. X    /* execute the main loop */
  864. X    if (code != NIL)
  865. X    xlexecute(code);
  866. X    wrapup();
  867. X}
  868. X
  869. Xusage()
  870. X{
  871. X    info("usage: xscheme [-t]\n");
  872. X    exit(1);
  873. X}
  874. X
  875. Xxlload() {}
  876. Xxlcontinue() {}
  877. Xxlbreak() { xltoplevel(); }
  878. Xxlcleanup() {}
  879. X
  880. X/* xltoplevel - return to the top level */
  881. Xxltoplevel()
  882. X{
  883. X    stdputstr("[ back to top level ]\n");
  884. X    longjmp(top_level,1);
  885. X}
  886. X
  887. X/* xlfail - report an error */
  888. Xxlfail(msg)
  889. X  char *msg;
  890. X{
  891. X    xlerror(msg,s_unbound);
  892. X}
  893. X
  894. X/* xlerror - report an error */
  895. Xxlerror(msg,arg)
  896. X  char *msg; LVAL arg;
  897. X{
  898. X    /* display the error message */
  899. X    errputstr("Error: ");
  900. X    errputstr(msg);
  901. X    errputstr("\n");
  902. X    
  903. X    /* print the argument on a separate line */
  904. X    if (arg != s_unbound) {
  905. X    errputstr("  ");
  906. X    errprint(arg);
  907. X    }
  908. X    
  909. X    /* print the function where the error occurred */
  910. X    errputstr("happened in: ");
  911. X    errprint(xlfun);
  912. X
  913. X    /* call the handler */
  914. X    callerrorhandler();
  915. X}
  916. X
  917. X/* callerrorhandler - call the error handler */
  918. Xcallerrorhandler()
  919. X{
  920. X    extern jmp_buf bc_dispatch;
  921. X    
  922. X    /* invoke the error handler */
  923. X    if (xlval = getvalue(xlenter("*ERROR-HANDLER*"))) {
  924. X    oscheck();    /* an opportunity to break out of a bad handler */
  925. X    check(2);
  926. X    push(xlenv);
  927. X    push(xlfun);
  928. X    xlargc = 2;
  929. X    xlapply();
  930. X    longjmp(bc_dispatch,1);
  931. X    }
  932. X
  933. X    /* no handler, just reset back to the top level */
  934. X    longjmp(top_level,1);
  935. X}
  936. X
  937. X/* xlabort - print an error message and abort */
  938. Xxlabort(msg)
  939. X  char *msg;
  940. X{
  941. X    /* display the error message */
  942. X    errputstr("Abort: ");
  943. X    errputstr(msg);
  944. X    errputstr("\n");
  945. X    
  946. X    /* print the function where the error occurred */
  947. X    errputstr("happened in: ");
  948. X    errprint(xlfun);
  949. X
  950. X    /* reset back to the top level */
  951. X    oscheck();    /* an opportunity to break out */
  952. X    longjmp(top_level,1);
  953. X}
  954. X
  955. X/* xlfatal - print a fatal error message and exit */
  956. Xxlfatal(msg)
  957. X  char *msg;
  958. X{
  959. X    oserror(msg);
  960. X    exit(1);
  961. X}
  962. X
  963. X/* info - display debugging information */
  964. Xinfo(fmt,a1,a2,a3,a4)
  965. X  char *fmt;
  966. X{
  967. X    char buf[100],*p;
  968. X    sprintf(buf,fmt,a1,a2,a3,a4);
  969. X    for (p = buf; *p != '\0'; )
  970. X    ostputc(*p++);
  971. X}
  972. X
  973. X/* wrapup - clean up and exit to the operating system */
  974. Xwrapup()
  975. X{
  976. X    if (tfp)
  977. X    osclose(tfp);
  978. X    osfinish();
  979. X    exit(0);
  980. X}
  981. END_OF_FILE
  982. if test 3864 -ne `wc -c <'Src/xscheme.c'`; then
  983.     echo shar: \"'Src/xscheme.c'\" unpacked with wrong size!
  984. fi
  985. # end of 'Src/xscheme.c'
  986. fi
  987. if test -f 'Src/xsinit.c' -a "${1}" != "-c" ; then 
  988.   echo shar: Will not clobber existing file \"'Src/xsinit.c'\"
  989. else
  990. echo shar: Extracting \"'Src/xsinit.c'\" \(7877 characters\)
  991. sed "s/^X//" >'Src/xsinit.c' <<'END_OF_FILE'
  992. X/* xsinit.c - xscheme initialization routines */
  993. X/*    Copyright (c) 1988, by David Michael Betz
  994. X    All Rights Reserved
  995. X    Permission is granted for unrestricted non-commercial use    */
  996. X
  997. X#include "xscheme.h"
  998. X#include "xsbcode.h"
  999. X
  1000. X/* macro to store a byte into a bytecode vector */
  1001. X#define pb(x)    (*bcode++ = (x))
  1002. X
  1003. X/* global variables */
  1004. XLVAL lk_optional,lk_rest;
  1005. XLVAL obarray,true,eof_object,default_object,s_unassigned;
  1006. XLVAL cs_map1,cs_foreach1,cs_withfile1,cs_load1,cs_force1;
  1007. XLVAL c_lpar,c_rpar,c_dot,c_quote,s_quote;
  1008. XLVAL s_eval,s_unbound,s_stdin,s_stdout,s_stderr;
  1009. XLVAL s_printcase,k_upcase,k_downcase;
  1010. XLVAL s_fixfmt,s_flofmt;
  1011. X
  1012. X/* external variables */
  1013. Xextern jmp_buf top_level;
  1014. Xextern FUNDEF funtab[];
  1015. Xextern int xsubrcnt;
  1016. Xextern int csubrcnt;
  1017. X
  1018. X/* xlinitws - create an initial workspace */
  1019. Xxlinitws(ssize)
  1020. X  unsigned int ssize;
  1021. X{
  1022. X    unsigned char *bcode;
  1023. X    int type,i;
  1024. X    LVAL code;
  1025. X    FUNDEF *p;
  1026. X
  1027. X    /* allocate memory for the workspace */
  1028. X    xlminit(ssize);
  1029. X
  1030. X    /* initialize the obarray */
  1031. X    s_unbound = NIL; /* to make cvsymbol work */
  1032. X    obarray = cvsymbol("*OBARRAY*");
  1033. X    setvalue(obarray,newvector(HSIZE));
  1034. X
  1035. X    /* add the symbol *OBARRAY* to the obarray */
  1036. X    setelement(getvalue(obarray),
  1037. X               hash(getstring(getpname(obarray)),HSIZE),
  1038. X               cons(obarray,NIL));
  1039. X
  1040. X    /* enter the eof object */
  1041. X    eof_object = cons(xlenter("**EOF**"),NIL);
  1042. X    
  1043. X    /* enter the default object */
  1044. X    default_object = cons(xlenter("**DEFAULT**"),NIL);
  1045. X
  1046. X    /* initialize the error handlers */
  1047. X    setvalue(xlenter("*ERROR-HANDLER*"),NIL);
  1048. X    setvalue(xlenter("*UNBOUND-HANDLER*"),NIL);
  1049. X    
  1050. X    /* install the built-in functions */
  1051. X    for (i = 0, p = funtab; p->fd_subr != NULL; ++i, ++p) {
  1052. X    type = (i < xsubrcnt ? XSUBR : (i < csubrcnt ? CSUBR : SUBR));
  1053. X    xlsubr(p->fd_name,type,p->fd_subr,i);
  1054. X    }
  1055. X    xloinit(); /* initialize xsobj.c */
  1056. X
  1057. X    /* setup some synonyms */
  1058. X    setvalue(xlenter("NOT"),getvalue(xlenter("NULL?")));
  1059. X    setvalue(xlenter("PRIN1"),getvalue(xlenter("WRITE")));
  1060. X    setvalue(xlenter("PRINC"),getvalue(xlenter("DISPLAY")));
  1061. X
  1062. X    /* enter all of the symbols used by the runtime system */
  1063. X    xlsymbols();
  1064. X
  1065. X    /* set the initial values of the symbols #T, T and NIL */
  1066. X    setvalue(true,true);
  1067. X    setvalue(xlenter("T"),true);
  1068. X    setvalue(xlenter("NIL"),NIL);
  1069. X
  1070. X    /* default to lowercase output of symbols */
  1071. X    setvalue(s_printcase,k_downcase);
  1072. X
  1073. X    /* setup the print formats for numbers */
  1074. X    s_fixfmt = xlenter("*FIXNUM-FORMAT*");
  1075. X    setvalue(s_fixfmt,cvstring(IFMT));
  1076. X    s_flofmt = xlenter("*FLONUM-FORMAT*");
  1077. X    setvalue(s_flofmt,cvstring(FFMT));
  1078. X    
  1079. X    /* build the 'eval' function */
  1080. X    code = newcode(4); cpush(code);
  1081. X    setelement(code,0,newstring(0x12));
  1082. X    setelement(code,1,xlenter("EVAL"));
  1083. X    setelement(code,2,cons(xlenter("X"),NIL));
  1084. X    setelement(code,3,xlenter("COMPILE"));
  1085. X    drop(1);
  1086. X
  1087. X    /* store the byte codes */
  1088. X    bcode = (unsigned char *)getstring(getbcode(code));
  1089. X
  1090. Xpb(OP_FRAME);pb(0x02);        /* 0000 12 02    FRAME 02        */
  1091. Xpb(OP_MVARG);pb(0x01);        /* 0002 13 01    MVARG 01        */
  1092. Xpb(OP_ALAST);            /* 0004 1a       ALAST            */
  1093. Xpb(OP_SAVE);pb(0x00);pb(0x10);    /* 0005 0b 00 10 SAVE 0010        */
  1094. Xpb(OP_EREF);pb(0x00);pb(0x01);    /* 0008 09 00 01 EREF 00 01 ; x        */
  1095. Xpb(OP_PUSH);            /* 000b 10       PUSH            */
  1096. Xpb(OP_GREF);pb(0x03);        /* 000c 05 03    GREF 03 ; compile    */
  1097. Xpb(OP_CALL);pb(0x01);        /* 000e 0c 01    CALL 01        */
  1098. Xpb(OP_CALL);pb(0x00);        /* 0010 0c 00    CALL 00        */
  1099. X
  1100. X    setvalue(getelement(code,1),cvclosure(code,NIL));
  1101. X
  1102. X    /* setup the initialization code */
  1103. X    code = newcode(6); cpush(code);
  1104. X    setelement(code,0,newstring(0x11));
  1105. X    setelement(code,1,xlenter("*INITIALIZE*"));
  1106. X    setelement(code,3,cvstring("xscheme.ini"));
  1107. X    setelement(code,4,xlenter("LOAD"));
  1108. X    setelement(code,5,xlenter("*TOPLEVEL*"));
  1109. X    drop(1);
  1110. X
  1111. X    /* store the byte codes */
  1112. X    bcode = (unsigned char *)getstring(getbcode(code));
  1113. X
  1114. Xpb(OP_FRAME);pb(0x01);        /* 0000 12 01    FRAME 01        */
  1115. Xpb(OP_ALAST);            /* 0002 1a       ALAST            */
  1116. Xpb(OP_SAVE); pb(0x00); pb(0x0d);/* 0003 0b 00 0d SAVE 000d        */
  1117. Xpb(OP_LIT);  pb(0x03);        /* 0006 04 03    LIT 03 ; "xscheme.ini"    */
  1118. Xpb(OP_PUSH);            /* 0008 10       PUSH            */
  1119. Xpb(OP_GREF); pb(0x04);        /* 0009 05 04    GREF 04 ; load        */
  1120. Xpb(OP_CALL); pb(0x01);        /* 000b 0c 01    CALL 01        */
  1121. Xpb(OP_GREF); pb(0x05);        /* 000d 05 05    GREF 05 ; *toplevel*    */
  1122. Xpb(OP_CALL); pb(0x00);        /* 000f 0c 00    CALL 00        */
  1123. X
  1124. X    setvalue(getelement(code,1),cvclosure(code,NIL));
  1125. X
  1126. X    /* setup the main loop code */
  1127. X    code = newcode(9); cpush(code);
  1128. X    setelement(code,0,newstring(0x28));
  1129. X    setelement(code,1,xlenter("*TOPLEVEL*"));
  1130. X    setelement(code,3,cvstring("\n> "));
  1131. X    setelement(code,4,xlenter("DISPLAY"));
  1132. X    setelement(code,5,xlenter("READ"));
  1133. X    setelement(code,6,xlenter("EVAL"));
  1134. X    setelement(code,7,xlenter("WRITE"));
  1135. X    setelement(code,8,xlenter("*TOPLEVEL*"));
  1136. X    drop(1);
  1137. X
  1138. X    /* store the byte codes */
  1139. X    bcode = (unsigned char *)getstring(getbcode(code));
  1140. X
  1141. Xpb(OP_FRAME);pb(0x01);        /* 0000 12 01    FRAME 01        */
  1142. Xpb(OP_ALAST);            /* 0002 1a       ALAST            */
  1143. Xpb(OP_SAVE); pb(0x00); pb(0x0d);/* 0003 0b 00 0d SAVE 000d        */
  1144. Xpb(OP_LIT);  pb(0x03);        /* 0006 04 03    LIT 03 ; "\n> "        */
  1145. Xpb(OP_PUSH);            /* 0008 10       PUSH            */
  1146. Xpb(OP_GREF); pb(0x04);        /* 0009 05 04    GREF 04 ; display    */
  1147. Xpb(OP_CALL); pb(0x01);        /* 000b 0c 01    CALL 01        */
  1148. Xpb(OP_SAVE); pb(0x00); pb(0x24);/* 000d 0b 00 24 SAVE 0024        */
  1149. Xpb(OP_SAVE); pb(0x00); pb(0x1f);/* 0010 0b 00 1f SAVE 001f        */
  1150. Xpb(OP_SAVE); pb(0x00); pb(0x1a);/* 0013 0b 00 1a SAVE 001a        */
  1151. Xpb(OP_GREF); pb(0x05);        /* 0016 05 05    GREF 05 ; read        */
  1152. Xpb(OP_CALL); pb(0x00);        /* 0018 0c 00    CALL 00        */
  1153. Xpb(OP_PUSH);            /* 001a 10       PUSH            */
  1154. Xpb(OP_GREF); pb(0x06);        /* 001b 05 06    GREF 06 ; eval        */
  1155. Xpb(OP_CALL); pb(0x01);        /* 001d 0c 01    CALL 01        */
  1156. Xpb(OP_PUSH);            /* 001f 10       PUSH            */
  1157. Xpb(OP_GREF); pb(0x07);        /* 0020 05 07    GREF 07 ; write    */
  1158. Xpb(OP_CALL); pb(0x01);        /* 0022 0c 01    CALL 01        */
  1159. Xpb(OP_GREF); pb(0x08);        /* 0024 05 08    GREF 08 ; *toplevel*    */
  1160. Xpb(OP_CALL); pb(0x00);        /* 0026 0c 00    CALL 00        */
  1161. X
  1162. X    setvalue(getelement(code,1),cvclosure(code,NIL));
  1163. X}
  1164. X
  1165. X/* xlsymbols - lookup/enter all symbols used by the runtime system */
  1166. Xxlsymbols()
  1167. X{
  1168. X    LVAL sym;
  1169. X    
  1170. X    /* top-level procedure symbol */
  1171. X    s_eval = xlenter("EVAL");
  1172. X    
  1173. X    /* enter the symbols used by the system */
  1174. X    true         = xlenter("#T");
  1175. X    s_unbound     = xlenter("*UNBOUND*");
  1176. X    s_unassigned = xlenter("#!UNASSIGNED");
  1177. X
  1178. X    /* enter the i/o symbols */
  1179. X    s_stdin  = xlenter("*STANDARD-INPUT*");
  1180. X    s_stdout = xlenter("*STANDARD-OUTPUT*");
  1181. X    s_stderr = xlenter("*ERROR-OUTPUT*");
  1182. X    
  1183. X    /* enter the symbols used by the printer */
  1184. X    s_fixfmt = xlenter("*FIXNUM-FORMAT*");
  1185. X    s_flofmt = xlenter("*FLONUM-FORMAT*");
  1186. X
  1187. X    /* enter the lambda list keywords */
  1188. X    lk_optional = xlenter("#!OPTIONAL");
  1189. X    lk_rest     = xlenter("#!REST");
  1190. X
  1191. X    /* enter symbols needed by the reader */
  1192. X    c_lpar   = xlenter("(");
  1193. X    c_rpar   = xlenter(")");
  1194. X    c_dot    = xlenter(".");
  1195. X    c_quote  = xlenter("'");
  1196. X    s_quote  = xlenter("QUOTE");
  1197. X
  1198. X    /* 'else' is a useful synonym for #t in cond clauses */
  1199. X    sym = xlenter("ELSE");
  1200. X    setvalue(sym,true);
  1201. X
  1202. X    /* setup stdin/stdout/stderr */
  1203. X    setvalue(s_stdin,cvport(stdin,PF_INPUT));
  1204. X    setvalue(s_stdout,cvport(stdout,PF_OUTPUT));
  1205. X    setvalue(s_stderr,cvport(stderr,PF_OUTPUT));
  1206. X
  1207. X    /* enter *print-case* and its keywords */
  1208. X    k_upcase    = xlenter("UPCASE");
  1209. X    k_downcase    = xlenter("DOWNCASE");
  1210. X    s_printcase    = xlenter("*PRINT-CASE*");
  1211. X
  1212. X    /* get the built-in continuation subrs */
  1213. X    cs_map1 = getvalue(xlenter("%MAP1"));
  1214. X    cs_foreach1 = getvalue(xlenter("%FOR-EACH1"));
  1215. X    cs_withfile1 = getvalue(xlenter("%WITH-FILE1"));
  1216. X    cs_load1 = getvalue(xlenter("%LOAD1"));
  1217. X    cs_force1 = getvalue(xlenter("%FORCE1"));
  1218. X
  1219. X    /* initialize xsobj.c */
  1220. X    obsymbols();
  1221. X}
  1222. END_OF_FILE
  1223. if test 7877 -ne `wc -c <'Src/xsinit.c'`; then
  1224.     echo shar: \"'Src/xsinit.c'\" unpacked with wrong size!
  1225. fi
  1226. # end of 'Src/xsinit.c'
  1227. fi
  1228. if test -f 'Src/xsio.c' -a "${1}" != "-c" ; then 
  1229.   echo shar: Will not clobber existing file \"'Src/xsio.c'\"
  1230. else
  1231. echo shar: Extracting \"'Src/xsio.c'\" \(2030 characters\)
  1232. sed "s/^X//" >'Src/xsio.c' <<'END_OF_FILE'
  1233. X/* xsio - xscheme i/o routines */
  1234. X/*    Copyright (c) 1988, by David Michael Betz
  1235. X    All Rights Reserved
  1236. X    Permission is granted for unrestricted non-commercial use    */
  1237. X
  1238. X#include "xscheme.h"
  1239. X
  1240. X/* global variables */
  1241. XFIXTYPE xlfsize;
  1242. X
  1243. X/* external variables */
  1244. Xextern LVAL s_stdin,s_stdout,s_stderr,s_unbound;
  1245. X
  1246. X/* xlgetc - get a character from a file or stream */
  1247. Xint xlgetc(fptr)
  1248. X  LVAL fptr;
  1249. X{
  1250. X    FILE *fp;
  1251. X    int ch;
  1252. X
  1253. X    /* check for input from nil */
  1254. X    if (fptr == NIL)
  1255. X    ch = EOF;
  1256. X
  1257. X    /* otherwise, check for a buffered character */
  1258. X    else if (ch = getsavech(fptr))
  1259. X    setsavech(fptr,'\0');
  1260. X
  1261. X    /* otherwise, check for terminal input or file input */
  1262. X    else {
  1263. X    fp = getfile(fptr);
  1264. X    if (fp == stdin || fp == stderr)
  1265. X        ch = ostgetc();
  1266. X    else if ((getpflags(fptr) & PF_BINARY) != 0)
  1267. X        ch = osbgetc(fp);
  1268. X    else
  1269. X        ch = osagetc(fp);
  1270. X    }
  1271. X
  1272. X    /* return the character */
  1273. X    return (ch);
  1274. X}
  1275. X
  1276. X/* xlungetc - unget a character */
  1277. Xxlungetc(fptr,ch)
  1278. X  LVAL fptr; int ch;
  1279. X{
  1280. X    /* check for ungetc from nil */
  1281. X    if (fptr == NIL)
  1282. X    ;
  1283. X    
  1284. X    /* otherwise, it must be a file */
  1285. X    else
  1286. X    setsavech(fptr,ch);
  1287. X}
  1288. X
  1289. X/* xlputc - put a character to a file or stream */
  1290. Xxlputc(fptr,ch)
  1291. X  LVAL fptr; int ch;
  1292. X{
  1293. X    FILE *fp;
  1294. X
  1295. X    /* count the character */
  1296. X    ++xlfsize;
  1297. X
  1298. X    /* check for output to nil */
  1299. X    if (fptr == NIL)
  1300. X    ;
  1301. X
  1302. X    /* otherwise, check for terminal output or file output */
  1303. X    else {
  1304. X    fp = getfile(fptr);
  1305. X    if (fp == stdout || fp == stderr)
  1306. X        ostputc(ch);
  1307. X    else if ((getpflags(fptr) & PF_BINARY) != 0)
  1308. X        osbputc(ch,fp);
  1309. X    else
  1310. X        osaputc(ch,fp);
  1311. X    }
  1312. X}
  1313. X
  1314. X/* xlflush - flush the input buffer */
  1315. Xint xlflush()
  1316. X{
  1317. X    osflush();
  1318. X}
  1319. X
  1320. X/* stdputstr - print a string to *standard-output* */
  1321. Xstdputstr(str)
  1322. X  char *str;
  1323. X{
  1324. X    xlputstr(getvalue(s_stdout),str);
  1325. X}
  1326. X
  1327. X/* errprint - print to *error-output* */
  1328. Xerrprint(expr)
  1329. X  LVAL expr;
  1330. X{
  1331. X    xlprin1(expr,getvalue(s_stderr));
  1332. X    xlterpri(getvalue(s_stderr));
  1333. X}
  1334. X
  1335. X/* errputstr - print a string to *error-output* */
  1336. Xerrputstr(str)
  1337. X  char *str;
  1338. X{
  1339. X    xlputstr(getvalue(s_stderr),str);
  1340. X}
  1341. END_OF_FILE
  1342. if test 2030 -ne `wc -c <'Src/xsio.c'`; then
  1343.     echo shar: \"'Src/xsio.c'\" unpacked with wrong size!
  1344. fi
  1345. # end of 'Src/xsio.c'
  1346. fi
  1347. if test -f 'Src/xsprint.c' -a "${1}" != "-c" ; then 
  1348.   echo shar: Will not clobber existing file \"'Src/xsprint.c'\"
  1349. else
  1350. echo shar: Extracting \"'Src/xsprint.c'\" \(6278 characters\)
  1351. sed "s/^X//" >'Src/xsprint.c' <<'END_OF_FILE'
  1352. X/* xsprint.c - xscheme print routine */
  1353. X/*    Copyright (c) 1988, by David Michael Betz
  1354. X    All Rights Reserved
  1355. X    Permission is granted for unrestricted non-commercial use    */
  1356. X
  1357. X#include "xscheme.h"
  1358. X
  1359. X/* global variables */
  1360. Xint prbreadth = -1;
  1361. Xint prdepth = -1;
  1362. X
  1363. X/* local variables */
  1364. Xstatic char buf[200];
  1365. X
  1366. X/* external variables */
  1367. Xextern LVAL true,s_printcase,k_downcase;
  1368. Xextern LVAL s_fixfmt,s_flofmt,s_unbound;
  1369. X
  1370. X/* xlprin1 - print an expression with quoting */
  1371. Xxlprin1(expr,file)
  1372. X  LVAL expr,file;
  1373. X{
  1374. X    print(file,expr,TRUE,0);
  1375. X}
  1376. X
  1377. X/* xlprinc - print an expression without quoting */
  1378. Xxlprinc(expr,file)
  1379. X  LVAL expr,file;
  1380. X{
  1381. X    print(file,expr,FALSE,0);
  1382. X}
  1383. X
  1384. X/* xlterpri - terminate the current print line */
  1385. Xxlterpri(fptr)
  1386. X  LVAL fptr;
  1387. X{
  1388. X    xlputc(fptr,'\n');
  1389. X}
  1390. X
  1391. X/* xlputstr - output a string */
  1392. Xxlputstr(fptr,str)
  1393. X  LVAL fptr; char *str;
  1394. X{
  1395. X    while (*str)
  1396. X    xlputc(fptr,*str++);
  1397. X}
  1398. X
  1399. X/* print - internal print routine */
  1400. XLOCAL print(fptr,vptr,escflag,depth)
  1401. X  LVAL fptr,vptr; int escflag,depth;
  1402. X{
  1403. X    int breadth,size,i;
  1404. X    LVAL nptr,next;
  1405. X
  1406. X    /* print nil */
  1407. X    if (vptr == NIL) {
  1408. X    xlputstr(fptr,"()");
  1409. X    return;
  1410. X    }
  1411. X
  1412. X    /* check value type */
  1413. X    switch (ntype(vptr)) {
  1414. X    case SUBR:
  1415. X    case XSUBR:
  1416. X        putsubr(fptr,"Subr",vptr);
  1417. X        break;
  1418. X    case CSUBR:
  1419. X        putsubr(fptr,"CSubr",vptr);
  1420. X        break;
  1421. X    case CONS:
  1422. X        if (prdepth >= 0 && depth >= prdepth) {
  1423. X        xlputstr(fptr,"(...)");
  1424. X        break;
  1425. X        }
  1426. X        xlputc(fptr,'(');
  1427. X        breadth = 0;
  1428. X        for (nptr = vptr; nptr != NIL; nptr = next) {
  1429. X        if (prbreadth >= 0 && breadth++ >= prbreadth) {
  1430. X            xlputstr(fptr,"...");
  1431. X            break;
  1432. X        }
  1433. X            print(fptr,car(nptr),escflag,depth+1);
  1434. X        if (next = cdr(nptr))
  1435. X            if (consp(next))
  1436. X            xlputc(fptr,' ');
  1437. X            else {
  1438. X            xlputstr(fptr," . ");
  1439. X            print(fptr,next,escflag,depth+1);
  1440. X            break;
  1441. X            }
  1442. X        }
  1443. X        xlputc(fptr,')');
  1444. X        break;
  1445. X    case VECTOR:
  1446. X        xlputstr(fptr,"#(");
  1447. X        for (i = 0, size = getsize(vptr); i < size; ++i) {
  1448. X        if (i != 0) xlputc(fptr,' ');
  1449. X        print(fptr,getelement(vptr,i),escflag,depth+1);
  1450. X        }
  1451. X        xlputc(fptr,')');
  1452. X        break;
  1453. X    case OBJECT:
  1454. X        putatm(fptr,"Object",vptr);
  1455. X        break;
  1456. X    case SYMBOL:
  1457. X        putsym(fptr,getstring(getpname(vptr)),escflag);
  1458. X        break;
  1459. X    case PROMISE:
  1460. X        if (getpproc(vptr) != NIL)
  1461. X        putatm(fptr,"Promise",vptr);
  1462. X        else
  1463. X        putatm(fptr,"Forced-promise",vptr);
  1464. X        break;
  1465. X    case CLOSURE:
  1466. X        putclosure(fptr,"Procedure",vptr);
  1467. X        break;
  1468. X    case METHOD:
  1469. X        putclosure(fptr,"Method",vptr);
  1470. X        break;
  1471. X    case FIXNUM:
  1472. X        putnumber(fptr,getfixnum(vptr));
  1473. X        break;
  1474. X    case FLONUM:
  1475. X        putflonum(fptr,getflonum(vptr));
  1476. X        break;
  1477. X    case CHAR:
  1478. X        if (escflag)
  1479. X        putcharacter(fptr,getchcode(vptr));
  1480. X        else
  1481. X        xlputc(fptr,getchcode(vptr));
  1482. X        break;
  1483. X    case STRING:
  1484. X        if (escflag)
  1485. X            putstring(fptr,getstring(vptr));
  1486. X        else
  1487. X            xlputstr(fptr,getstring(vptr));
  1488. X        break;
  1489. X    case PORT:
  1490. X        putatm(fptr,"Port",vptr);
  1491. X        break;
  1492. X    case CODE:
  1493. X        putcode(fptr,"Code",vptr);
  1494. X        break;
  1495. X    case CONTINUATION:
  1496. X        putatm(fptr,"Escape-procedure",vptr);
  1497. X        break;
  1498. X    case ENV:
  1499. X        putatm(fptr,"Environment",vptr);
  1500. X        break;
  1501. X    case FREE:
  1502. X        putatm(fptr,"Free",vptr);
  1503. X        break;
  1504. X    default:
  1505. X        putatm(fptr,"Foo",vptr);
  1506. X        break;
  1507. X    }
  1508. X}
  1509. X
  1510. X/* putatm - output an atom */
  1511. XLOCAL putatm(fptr,tag,val)
  1512. X  LVAL fptr; char *tag; LVAL val;
  1513. X{
  1514. X    sprintf(buf,"#<%s #",tag); xlputstr(fptr,buf);
  1515. X    sprintf(buf,AFMT,val); xlputstr(fptr,buf);
  1516. X    xlputc(fptr,'>');
  1517. X}
  1518. X
  1519. X/* putstring - output a string */
  1520. XLOCAL putstring(fptr,str)
  1521. X  LVAL fptr; char *str;
  1522. X{
  1523. X    int ch;
  1524. X
  1525. X    /* output the initial quote */
  1526. X    xlputc(fptr,'"');
  1527. X
  1528. X    /* output each character in the string */
  1529. X    while (ch = *str++)
  1530. X
  1531. X    /* check for a control character */
  1532. X    if (ch < 040 || ch == '\\' || ch == '"') {
  1533. X        xlputc(fptr,'\\');
  1534. X        switch (ch) {
  1535. X        case '\033':
  1536. X            xlputc(fptr,'e');
  1537. X            break;
  1538. X        case '\n':
  1539. X            xlputc(fptr,'n');
  1540. X            break;
  1541. X        case '\r':
  1542. X            xlputc(fptr,'r');
  1543. X            break;
  1544. X        case '\t':
  1545. X            xlputc(fptr,'t');
  1546. X            break;
  1547. X        case '\\':
  1548. X        case '"':
  1549. X            xlputc(fptr,ch);
  1550. X            break;
  1551. X        default:
  1552. X            putoct(fptr,ch);
  1553. X            break;
  1554. X        }
  1555. X    }
  1556. X
  1557. X    /* output a normal character */
  1558. X    else
  1559. X        xlputc(fptr,ch);
  1560. X
  1561. X    /* output the terminating quote */
  1562. X    xlputc(fptr,'"');
  1563. X}
  1564. X
  1565. X/* putsym - output a symbol */
  1566. XLOCAL putsym(fptr,str,escflag)
  1567. X  LVAL fptr; char *str; int escflag;
  1568. X{
  1569. X    int ch;
  1570. X
  1571. X    /* check for printing without escapes */
  1572. X    if (!escflag) {
  1573. X    xlputstr(fptr,str);
  1574. X    return;
  1575. X    }
  1576. X
  1577. X    /* output each character */
  1578. X    if (getvalue(s_printcase) == k_downcase) {
  1579. X    while ((ch = *str++) != '\0')
  1580. X        xlputc(fptr,isupper(ch) ? tolower(ch) : ch);
  1581. X    }
  1582. X    else {
  1583. X    while ((ch = *str++) != '\0')
  1584. X        xlputc(fptr,islower(ch) ? toupper(ch) : ch);
  1585. X    }
  1586. X}
  1587. X
  1588. X/* putsubr - output a subr/fsubr */
  1589. XLOCAL putsubr(fptr,tag,val)
  1590. X  LVAL fptr; char *tag; LVAL val;
  1591. X{
  1592. X    extern FUNDEF funtab[];
  1593. X    sprintf(buf,"#<%s %s>",tag,funtab[getoffset(val)].fd_name);
  1594. X    xlputstr(fptr,buf);
  1595. X}
  1596. X
  1597. X/* putclosure - output a closure */
  1598. XLOCAL putclosure(fptr,tag,val)
  1599. X  LVAL fptr; char *tag; LVAL val;
  1600. X{
  1601. X    putcode(fptr,tag,getcode(val));
  1602. X}
  1603. X
  1604. X/* putcode - output a code object */
  1605. XLOCAL putcode(fptr,tag,val)
  1606. X  LVAL fptr; char *tag; LVAL val;
  1607. X{
  1608. X    LVAL name;
  1609. X    if (name = getelement(val,1)) {
  1610. X    sprintf(buf,"#<%s %s>",tag,getstring(getpname(name)));
  1611. X    xlputstr(fptr,buf);
  1612. X    }
  1613. X    else
  1614. X    putatm(fptr,tag,val);
  1615. X}
  1616. X
  1617. X/* putnumber - output a number */
  1618. XLOCAL putnumber(fptr,n)
  1619. X  LVAL fptr; FIXTYPE n;
  1620. X{
  1621. X    LVAL fmt = getvalue(s_fixfmt);
  1622. X    sprintf(buf,(stringp(fmt) ? (char *)getstring(fmt) : IFMT),n);
  1623. X    xlputstr(fptr,buf);
  1624. X}
  1625. X
  1626. X/* putoct - output an octal byte value */
  1627. XLOCAL putoct(fptr,n)
  1628. X  LVAL fptr; int n;
  1629. X{
  1630. X    sprintf(buf,"%03o",n);
  1631. X    xlputstr(fptr,buf);
  1632. X}
  1633. X
  1634. X/* putflonum - output a flonum */
  1635. XLOCAL putflonum(fptr,n)
  1636. X  LVAL fptr; FLOTYPE n;
  1637. X{
  1638. X    LVAL fmt = getvalue(s_flofmt);
  1639. X    sprintf(buf,(stringp(fmt) ? (char *)getstring(fmt) : FFMT),n);
  1640. X    xlputstr(fptr,buf);
  1641. X}
  1642. X
  1643. X/* putcharacter - output a character value */
  1644. XLOCAL putcharacter(fptr,ch)
  1645. X  LVAL fptr; int ch;
  1646. X{
  1647. X    switch (ch) {
  1648. X    case '\n':
  1649. X    xlputstr(fptr,"#\\Newline");
  1650. X    break;
  1651. X    case ' ':
  1652. X    xlputstr(fptr,"#\\Space");
  1653. X    break;
  1654. X    default:
  1655. X    sprintf(buf,"#\\%c",ch);
  1656. X    xlputstr(fptr,buf);
  1657. X    break;
  1658. X    }
  1659. X}
  1660. END_OF_FILE
  1661. if test 6278 -ne `wc -c <'Src/xsprint.c'`; then
  1662.     echo shar: \"'Src/xsprint.c'\" unpacked with wrong size!
  1663. fi
  1664. # end of 'Src/xsprint.c'
  1665. fi
  1666. if test -f 'Src/xssym.c' -a "${1}" != "-c" ; then 
  1667.   echo shar: Will not clobber existing file \"'Src/xssym.c'\"
  1668. else
  1669. echo shar: Extracting \"'Src/xssym.c'\" \(1934 characters\)
  1670. sed "s/^X//" >'Src/xssym.c' <<'END_OF_FILE'
  1671. X/* xssym.c - symbol handling routines */
  1672. X/*    Copyright (c) 1988, by David Michael Betz
  1673. X    All Rights Reserved
  1674. X    Permission is granted for unrestricted non-commercial use    */
  1675. X
  1676. X#include "xscheme.h"
  1677. X
  1678. X/* external variables */
  1679. Xextern LVAL obarray;
  1680. X
  1681. X/* forward declarations */
  1682. XLVAL findprop();
  1683. X
  1684. X/* xlsubr - define a builtin function */
  1685. Xxlsubr(sname,type,fcn,offset)
  1686. X  char *sname; int type; LVAL (*fcn)(); int offset;
  1687. X{
  1688. X    LVAL sym;
  1689. X    sym = xlenter(sname);
  1690. X    setvalue(sym,cvsubr(type,fcn,offset));
  1691. X}
  1692. X
  1693. X/* xlenter - enter a symbol into the obarray */
  1694. XLVAL xlenter(name)
  1695. X  char *name;
  1696. X{
  1697. X    LVAL array,sym;
  1698. X    int i;
  1699. X
  1700. X    /* get the current obarray and the hash index for this symbol */
  1701. X    array = getvalue(obarray);
  1702. X    i = hash(name,HSIZE);
  1703. X
  1704. X    /* check if symbol is already in table */
  1705. X    for (sym = getelement(array,i); sym; sym = cdr(sym))
  1706. X    if (strcmp(name,getstring(getpname(car(sym)))) == 0)
  1707. X        return (car(sym));
  1708. X
  1709. X    /* make a new symbol node and link it into the list */
  1710. X    sym = cons(cvsymbol(name),getelement(array,i));
  1711. X    setelement(array,i,sym);
  1712. X    sym = car(sym);
  1713. X
  1714. X    /* return the new symbol */
  1715. X    return (sym);
  1716. X}
  1717. X
  1718. X/* xlgetprop - get the value of a property */
  1719. XLVAL xlgetprop(sym,prp)
  1720. X  LVAL sym,prp;
  1721. X{
  1722. X    LVAL p;
  1723. X    return ((p = findprop(sym,prp)) ? car(p) : NIL);
  1724. X}
  1725. X
  1726. X/* xlputprop - put a property value onto the property list */
  1727. Xxlputprop(sym,val,prp)
  1728. X  LVAL sym,val,prp;
  1729. X{
  1730. X    LVAL pair;
  1731. X    if (pair = findprop(sym,prp))
  1732. X    rplaca(pair,val);
  1733. X    else
  1734. X    setplist(sym,cons(prp,cons(val,getplist(sym))));
  1735. X}
  1736. X
  1737. X/* findprop - find a property pair */
  1738. XLOCAL LVAL findprop(sym,prp)
  1739. X  LVAL sym,prp;
  1740. X{
  1741. X    LVAL p;
  1742. X    for (p = getplist(sym); consp(p) && consp(cdr(p)); p = cdr(cdr(p)))
  1743. X    if (car(p) == prp)
  1744. X        return (cdr(p));
  1745. X    return (NIL);
  1746. X}
  1747. X
  1748. X/* hash - hash a symbol name string */
  1749. Xint hash(str,len)
  1750. X  char *str;
  1751. X{
  1752. X    int i;
  1753. X    for (i = 0; *str; )
  1754. X    i = (i << 2) ^ *str++;
  1755. X    i %= len;
  1756. X    return (i < 0 ? -i : i);
  1757. X}
  1758. END_OF_FILE
  1759. if test 1934 -ne `wc -c <'Src/xssym.c'`; then
  1760.     echo shar: \"'Src/xssym.c'\" unpacked with wrong size!
  1761. fi
  1762. # end of 'Src/xssym.c'
  1763. fi
  1764. if test -f 'david.betz' -a "${1}" != "-c" ; then 
  1765.   echo shar: Will not clobber existing file \"'david.betz'\"
  1766. else
  1767. echo shar: Extracting \"'david.betz'\" \(1083 characters\)
  1768. sed "s/^X//" >'david.betz' <<'END_OF_FILE'
  1769. XFrom mimsy!haven!aplcen!uunet!mitel!sce!ulysses!garym Fri Nov 17 02:00:09 EST 1989
  1770. XArticle 59 of comp.lang.lisp.x:
  1771. XPath: fe2o3!mimsy!haven!aplcen!uunet!mitel!sce!ulysses!garym
  1772. X>From: garym@ulysses.UUCP (Gary Murphy)
  1773. XNewsgroups: comp.lang.lisp.x
  1774. XSubject: Re: Author! Author!
  1775. XSummary: Lists the phone number for MIPS (XLisp) BBS
  1776. XKeywords: XLisp Betz MIPS
  1777. XMessage-ID: <7472@ulysses.UUCP>
  1778. XDate: 13 Nov 89 19:36:35 GMT
  1779. XReferences: <1989Nov9.180124.24190@rpi.edu> <6327@tekgvs.LABS.TEK.COM>
  1780. XReply-To: garym@cognos.UUCP (Gary Murphy)
  1781. XOrganization: Cognos Inc., Ottawa, Canada
  1782. XLines: 15
  1783. X
  1784. XI know this has been posted before, because this is where I got it.
  1785. X
  1786. XDavid Betz _may_ be reached at the MIPS Magazine BBS
  1787. X(603) 882-1599, 2400BAUD, 8-N-1
  1788. X
  1789. XThis BBS also carries the latest versions of XLisp and XScheme.
  1790. X
  1791. X
  1792. X
  1793. X
  1794. X-- 
  1795. XGary Murphy                   decvax!utzoo!dciem!nrcaer!cognos!garym
  1796. X                              (garym%cognos.uucp@uunet.uu.net)
  1797. X(613) 738-1338 x5537          Cognos Inc. P.O. Box 9707 Ottawa K1G 3N3
  1798. X"There are many things which do not concern the process" - Joan of Arc
  1799. X
  1800. X
  1801. END_OF_FILE
  1802. if test 1083 -ne `wc -c <'david.betz'`; then
  1803.     echo shar: \"'david.betz'\" unpacked with wrong size!
  1804. fi
  1805. # end of 'david.betz'
  1806. fi
  1807. if test -f 'histogram.s' -a "${1}" != "-c" ; then 
  1808.   echo shar: Will not clobber existing file \"'histogram.s'\"
  1809. else
  1810. echo shar: Extracting \"'histogram.s'\" \(748 characters\)
  1811. sed "s/^X//" >'histogram.s' <<'END_OF_FILE'
  1812. X(define (histogram data-list)
  1813. X  (let* ((high (apply max data-list))
  1814. X     (low (apply min data-list))
  1815. X     (how-many (- high low -1))
  1816. X     (hist (make-vector how-many 0))
  1817. X     (index 0)
  1818. X     (answer nil)
  1819. X     )
  1820. X    (do ((i data-list (cdr i)))
  1821. X    ((null? i))
  1822. X      (set! index (- (car i) low))
  1823. X      (vector-set! hist index (1+ (vector-ref hist index)))
  1824. X      )
  1825. X    (set! answer (vector->list hist))
  1826. X    (list low high answer)
  1827. X  )
  1828. X)
  1829. X
  1830. X(define (hist-graph hist)
  1831. X  (let ((start (car hist))
  1832. X    (end (cadr hist))
  1833. X    (hmax (apply max (caddr hist)))
  1834. X    (hmin (apply min (caddr hist))))
  1835. X    (begin
  1836. X      (newline)
  1837. X      (do ((i start (1+ i))
  1838. X       (tbl (caddr hist) (cdr tbl)))
  1839. X      ((> i end) "Done")
  1840. X    (writeln i #\     (make-string  (round (* (/ (car tbl) hmax) 40))  #\*))
  1841. X      )
  1842. X      )))
  1843. END_OF_FILE
  1844. if test 748 -ne `wc -c <'histogram.s'`; then
  1845.     echo shar: \"'histogram.s'\" unpacked with wrong size!
  1846. fi
  1847. # end of 'histogram.s'
  1848. fi
  1849. if test -f 'macros.s' -a "${1}" != "-c" ; then 
  1850.   echo shar: Will not clobber existing file \"'macros.s'\"
  1851. else
  1852. echo shar: Extracting \"'macros.s'\" \(2613 characters\)
  1853. sed "s/^X//" >'macros.s' <<'END_OF_FILE'
  1854. X(define %compile compile)
  1855. X
  1856. X(define (%expand-macros expr)
  1857. X  (if (pair? expr)
  1858. X    (if (symbol? (car expr))
  1859. X      (let ((expander (get (car expr) '%syntax)))
  1860. X        (if expander
  1861. X          (expander expr)
  1862. X          (let ((expander (get (car expr) '%macro)))
  1863. X            (if expander
  1864. X              (%expand-macros (expander expr))
  1865. X              (cons (car expr) (%expand-list (cdr expr)))))))
  1866. X      (%expand-list expr))
  1867. X    expr))
  1868. X
  1869. X(define (%expand-list lyst)
  1870. X  (if (pair? lyst)
  1871. X    (cons (%expand-macros (car lyst)) (%expand-list (cdr lyst)))
  1872. X    lyst))
  1873. X
  1874. X(define (compile expr #!optional env)
  1875. X  (if (default-object? env)
  1876. X    (%compile (%expand-macros expr))
  1877. X    (%compile (%expand-macros expr) env)))
  1878. X
  1879. X(put 'macro '%macro
  1880. X  (lambda (form)
  1881. X    (list 'put
  1882. X          (list 'quote (cadr form))
  1883. X          (list 'quote '%macro)
  1884. X          (caddr form))))
  1885. X
  1886. X(macro syntax
  1887. X  (lambda (form)
  1888. X    #f))
  1889. X
  1890. X(macro compiler-syntax
  1891. X  (lambda (form)
  1892. X    (list 'put
  1893. X          (list 'quote (cadr form))
  1894. X          (list 'quote '%syntax)
  1895. X          (caddr form))))
  1896. X
  1897. X(compiler-syntax quote
  1898. X  (lambda (form) form))
  1899. X      
  1900. X(compiler-syntax lambda
  1901. X  (lambda (form)
  1902. X    (cons
  1903. X      'lambda
  1904. X      (cons
  1905. X        (cadr form)
  1906. X        (%expand-list (cddr form))))))
  1907. X
  1908. X(compiler-syntax define
  1909. X  (lambda (form)
  1910. X    (cons
  1911. X      'define
  1912. X      (cons
  1913. X        (cadr form)
  1914. X        (%expand-list (cddr form))))))
  1915. X  
  1916. X(compiler-syntax set!
  1917. X  (lambda (form)
  1918. X    (cons
  1919. X      'set!
  1920. X      (cons
  1921. X        (cadr form)
  1922. X        (%expand-list (cddr form))))))
  1923. X
  1924. X(define (%cond-expander lyst)
  1925. X  (cond
  1926. X      ((pair? lyst)
  1927. X       (cons
  1928. X         (if (pair? (car lyst))
  1929. X           (%expand-list (car lyst))
  1930. X           (car lyst))
  1931. X         (%cond-expander (cdr lyst))))
  1932. X      (else lyst)))
  1933. X
  1934. X(compiler-syntax cond
  1935. X  (lambda (form)
  1936. X    (cons 'cond (%cond-expander (cdr form)))))
  1937. X
  1938. X; The following code for expanding let/let*/letrec was donated by:
  1939. X;
  1940. X; Harald Hanche-Olsen
  1941. X; The University of Trondheim
  1942. X; The Norwegian Institute of Technology
  1943. X; Division of Mathematics
  1944. X; N-7034 Trondheim NTH
  1945. X; Norway
  1946. X
  1947. X(define (%expand-let-assignment pair)
  1948. X  (if (pair? pair)
  1949. X    (cons
  1950. X      (car pair)
  1951. X      (%expand-macros (cdr pair)))
  1952. X    pair))
  1953. X
  1954. X(define (%expand-let-form form)
  1955. X  (cons
  1956. X    (car form)
  1957. X    (cons
  1958. X      (let ((lyst (cadr form)))
  1959. X        (if (pair? lyst)
  1960. X          (map %expand-let-assignment lyst)
  1961. X          lyst))
  1962. X      (%expand-list (cddr form)))))
  1963. X
  1964. X(compiler-syntax let %expand-let-form)
  1965. X(compiler-syntax let* %expand-let-form)
  1966. X(compiler-syntax letrec %expand-let-form)
  1967. X
  1968. X(macro define-integrable
  1969. X  (lambda (form)
  1970. X    (cons 'define (cdr form))))
  1971. X
  1972. X(macro declare
  1973. X  (lambda (form) #f))
  1974. END_OF_FILE
  1975. if test 2613 -ne `wc -c <'macros.s'`; then
  1976.     echo shar: \"'macros.s'\" unpacked with wrong size!
  1977. fi
  1978. # end of 'macros.s'
  1979. fi
  1980. if test -f 'mystuff.s.uu' -a "${1}" != "-c" ; then 
  1981.   echo shar: Will not clobber existing file \"'mystuff.s.uu'\"
  1982. else
  1983. echo shar: Extracting \"'mystuff.s.uu'\" \(3155 characters\)
  1984. sed "s/^X//" >'mystuff.s.uu' <<'END_OF_FILE'
  1985. Xbegin 664 mystuff.s
  1986. XM.R`@06-K97)M86YN(&9U;F-T:6]N("TM("AA8VL@-"`Q*2!T86ME<R!A($Q/$
  1987. XM3D<L($Q/3D<@=&EM92$A(0HH9&5F:6YE("AA8VL@;2!N*0H@("`@("`H8V]N-
  1988. XM9"`H*#T@;2`P*2`@*#$K(&XI*0H@("`@("`@("`@("`H*#T@;B`P*2`@*&%C%
  1989. XM:R`H+3$K(&TI(#$I*0H@("`@("`@("`@("`H96QS92`@("`@*&%C:R`H+3$KX
  1990. XM(&TI("AA8VL@;2`H+3$K(&XI*2DI*2D*"CL@4')O<&5R;'D@=&%I;"UR96-U!
  1991. XM<G-I=F4@9F%C=&]R:6%L(&9U;F-T:6]N"BAD969I;F4@*&9A8W0@;BD*"2AD=
  1992. XM969I;F4@*&9A8W0M:71E<B!C;W5N="!A;G-W97(I"@D)*&EF("@\(&-O=6YT0
  1993. XM(#(I"@D)("`@(&%N<W=E<@H)"2`@("`H9F%C="UI=&5R("@M,2L@8V]U;G0IM
  1994. XM("@J(&-O=6YT(&%N<W=E<BDI*2D*"2AF86-T+6ET97(@;B`Q*2D*"CL@4W1A1
  1995. XM;F1A<F0H/RD@1FEB;VYA8V-I('-E<75E;F-E(&9U;F-T:6]N"CL@1FEB;VYAJ
  1996. XM8V-I('-E<75E;F-E<B`@(#$@,2`R(#,@-2`X(#$S(#(Q(#,T(#4U(#@Y("X@E
  1997. XM+B`N"BAD969I;F4@*&9I8B!N*0H@("`@*&EF("@\(&X@,BD*"0DQ"@D)*"L@S
  1998. XM*&9I8B`H+2!N(#(I*0H)"2`@("AF:6(@*"T@;B`Q*2D*"0DI"@DI"BD*"CL@>
  1999. XM4')O9'5C92!A(&QI<W0@;V8@:6YT96=E<G,@9G)O;2!-5TBR+4E/5$$M0D%34
  2000. XM12!T;R!N+@H[(%-I;6EL87(@=&\@05!,)W,@(&EO=&$@9G5N8W1I;VXN"BAD+
  2001. XM969I;F4@*&EO=&$@;BD*"2AD969I;F4@*&EO=&$M:71E<B!S=&%R="!C;W5N2
  2002. XM="!A;G-W97(I"@D)*&EF("AP;W-I=&EV93\@8V]U;G0I"@D)"2AA<'!E;F0@Q
  2003. XM*&QI<W0@<W1A<G0I("AI;W1A+6ET97(@*#$K('-T87)T*2`H+3$K(&-O=6YTF
  2004. XM*2!A;G-W97(I*0H)"0EA;G-W97(I*0H@("`@*&EO=&$M:71E<B!-5TBR+4E/U
  2005. XM5$$M0D%312!N("@I*0HI"BAD969I;F4@35=(LBU)3U1!+4)!4T4@,2D**&1IN
  2006. XM<W!L87D@(DU72+(M24]402U"05-%('-E="!T;R`Q(BD**&YE=VQI;F4I"@H[2
  2007. XM($9O<B!T:&4@=VEN=&5R("TM(%=I;F0@0VAI;&P@26YD97@@8V%L8W5L871O)
  2008. XM<@HH9&5F:6YE("AF+3YC(&9A:'(I"@DH+2`H+R`H*B`H*R!F86AR(#0P+C`I%
  2009. XM"@D)"2`U+C`I"@D)("`Y+C`I"B`@("`@("`T,"XP*0HI"BAD969I;F4@*&,M:
  2010. XM/F8@8V5L<VEU<RD*"2@M("@O("@J("@K(&-E;'-I=7,@-#`N,"D*"0D)(#DNX
  2011. XM,"D*"0D@(#4N,"D*("`@("`@(#0P+C`I"BD**&1E9FEN92`H=V-I(&8M=&5M:
  2012. XM<"!M<&@M=VEN9"D*("`H9&5F:6YE("AM<&@M=&\M;7!S(&UP:"D*("`@("@J^
  2013. XM(&UP:`H@("`@("`@*"\@*"H@-3(X,"XP(#$R+C`@,C4N-"D@*"H@,S8P,"XP1
  2014. XM(#$P,#`N,"DI*2D*("`H9&5F:6YE("AW:6YD+6-H:6QL+69A8W1O<B!C+71EH
  2015. XM;7`@;7!S+7=I;F0I"B`@("`H*B`H*R`Q,"XT-0H)("`H*B`Q,"XP("AS<7)T2
  2016. XM(&UP<RUW:6YD*2D*"2`@*"T@;7!S+7=I;F0I*0H@("`@("`@*"T@,S,N,"!C0
  2017. XM+71E;7`I*2D*("`H;&5T*B`H*&UE=')I8RTT;7!H("AM<&@M=&\M;7!S(#0NU
  2018. XM,"DI"@D@*&UE=')I8RUT96UP("AF+3YC(&8M=&5M<"DI"@D@*&UE=')I8RUW^
  2019. XM:6YD("AI9B`H/"!M<&@M=VEN9"`T+C`I"@D)"2`@;65T<FEC+31M<&@*"0D)I
  2020. XM*&UP:"UT;RUM<',@;7!H+7=I;F0I*2D*"2`H;7DM=V-F("AW:6YD+6-H:6QL:
  2021. XM+69A8W1O<B!M971R:6,M=&5M<"!M971R:6,M=VEN9"DI"@D@*0H@("`@*&EFE
  2022. XM("@\/2!M<&@M=VEN9"`T-2XP*0H)*&,M/F8@*"T@,S,N,`H)"2`H+R!M>2UW:
  2023. XM8V8*"0D@("`@*"L@,3`N-#4*"0D@("`@("`@*"H@,3`N,"`H<W%R="!M971RG
  2024. XM:6,M-&UP:"DI"@D)("`@("`@("@M(&UE=')I8RTT;7!H*2DI*2D*("`@("`@V
  2025. XM*'!R:6YT(")%<G)O<CH@5VEN9"!S<&5E9"!T;V\@:&EG:"!;/C0U+6UP:%TB#
  2026. XM*2DI*0H**&1I<W!L87D@(E5S86=E.B`H=V-I(&9A:')E;FAE:70M=&5M<"!W*
  2027. XM:6YD+7-P965D+6UP:"DB*0HH;F5W;&EN92D*"BAD969I;F4@*&9R965S<"D*3
  2028. XM"2AL970@*"AM96TM=7-A9V4@*&=C(#`@,"DI*0H)"2AW<FET96QN(")#86QL;
  2029. XM<R!T;R!'0SHC7`D)(B`H8V%R(&UE;2UU<V%G92DI"@D)*'=R:71E;&X@(DYO&
  2030. XM9&5S.B-<"0D)(B`H8V%D<B!M96TM=7-A9V4I*0H)"2AW<FET96QN(")&<F5E4
  2031. XM(&YO9&5S.B-<"0DB("AC861D<B!M96TM=7-A9V4I*0H)"2AW<FET96QN(").X
  2032. XM;V1E('-E9VUE;G1S.B-<"0DB("AC861D9'(@;65M+75S86=E*2D*"0DH=W)I>
  2033. XM=&5L;B`B5F5C=&]R('-E9VUE;G1S.B-<"2(@*&-A<B`H8V1D9&1R(&UE;2UU^
  2034. XM<V%G92DI*0H)"2AW<FET96QN(")(96%P('-I>F4Z(UP)"2(@*&-A9'(@*&-D=
  2035. X59&1D<B!M96TM=7-A9V4I*2D*"2DI?
  2036. X``
  2037. Xend
  2038. Xsize 2226
  2039. END_OF_FILE
  2040. if test 3155 -ne `wc -c <'mystuff.s.uu'`; then
  2041.     echo shar: \"'mystuff.s.uu'\" unpacked with wrong size!
  2042. fi
  2043. # end of 'mystuff.s.uu'
  2044. fi
  2045. if test -f 'pi-calc.s' -a "${1}" != "-c" ; then 
  2046.   echo shar: Will not clobber existing file \"'pi-calc.s'\"
  2047. else
  2048. echo shar: Extracting \"'pi-calc.s'\" \(578 characters\)
  2049. sed "s/^X//" >'pi-calc.s' <<'END_OF_FILE'
  2050. X(define (pi-calc n)
  2051. X    (define (a n)
  2052. X        (if (zero? n)
  2053. X            1
  2054. X            (/ (+ (a (-1+ n))
  2055. X                  (b (-1+ n)))
  2056. X               2)))
  2057. X    (define (b n)
  2058. X        (if (zero? n)
  2059. X            (/ (sqrt 2))
  2060. X            (sqrt (* (a (-1+ n))
  2061. X                     (b (-1+ n))))))
  2062. X    (define (square x)
  2063. X        (* x x))
  2064. X    (define (two2theN n)
  2065. X        (if (zero? n)
  2066. X            1
  2067. X            (* 2 (two2theN (-1+ n)))))
  2068. X    (define (sumof start end func)
  2069. X        (let ((first (func start)))
  2070. X            (if (= start end)
  2071. X                first
  2072. X                (+ first (sumof (1+ start) end func)))))
  2073. X    (define (denom-func i)
  2074. X        (* (two2theN i)
  2075. X           (square (- (a i) (b i)))))
  2076. X    (/  (* 4 (a n) (b n))
  2077. X        (- 1 (sumof 0 (-1+ n) denom-func))))
  2078. END_OF_FILE
  2079. if test 578 -ne `wc -c <'pi-calc.s'`; then
  2080.     echo shar: \"'pi-calc.s'\" unpacked with wrong size!
  2081. fi
  2082. # end of 'pi-calc.s'
  2083. fi
  2084. if test -f 'qquote.s' -a "${1}" != "-c" ; then 
  2085.   echo shar: Will not clobber existing file \"'qquote.s'\"
  2086. else
  2087. echo shar: Extracting \"'qquote.s'\" \(2744 characters\)
  2088. sed "s/^X//" >'qquote.s' <<'END_OF_FILE'
  2089. X;;; QQUOTE.S  01-14-89 11:34 AM by John Armstrong
  2090. X
  2091. X;; Expands QUASIQUOTE/UNQUOTE/UNQUOTE according to Rev^3 Report specs.
  2092. X;;
  2093. X;; This file can be included as is in XSCHEME.INI, or can be incorporated 
  2094. X;; into MACROS.S, with expander functions anywhere and macros after
  2095. X;; after definition of COMPILER-SYNTAX
  2096. X
  2097. X;;; EXPANDER-FUNCTIONS: compilable under the core XSCHEME, can be evaluated
  2098. X;;; independently of MACRO system
  2099. X
  2100. X(define APPEND-ME-SYM (gensym)) ;; must be a gensym to avoid capture in
  2101. X                ;; certain (pathological) situations
  2102. X
  2103. X(define QQ-EXPANDER
  2104. X  (lambda (l)
  2105. X      (letrec
  2106. X       (
  2107. X        (qq-lev 0) ; always >= 0
  2108. X        (QQ-CAR-CDR
  2109. X         (lambda (exp)
  2110. X             (let ((qq-car (qq (car exp)))
  2111. X               (qq-cdr (qq (cdr exp))))
  2112. X              (if (and (pair? qq-car)
  2113. X                   (eq? (car qq-car) append-me-sym))
  2114. X                  (list 'append (cdr qq-car) qq-cdr)
  2115. X                  (list 'cons qq-car qq-cdr)))))
  2116. X        (QQ
  2117. X         (lambda (exp)
  2118. X             (cond ((symbol? exp)
  2119. X                (list 'quote exp))
  2120. X               ((vector? exp)
  2121. X                (list 'list->vector (qq (vector->list exp))))
  2122. X               ((atom? exp) ; nil, number or boolean
  2123. X                exp)
  2124. X               ((eq? (car exp) 'quasiquote)
  2125. X                (set! qq-lev (1+ qq-lev))
  2126. X                (let ((qq-val
  2127. X                   (if (= qq-lev 1) ; min val after inc
  2128. X                       ; --> outermost level
  2129. X                       (qq (cadr exp))
  2130. X                       (qq-car-cdr exp))))
  2131. X                 (set! qq-lev (-1+ qq-lev))
  2132. X                 qq-val))
  2133. X               ((or (eq? (car exp) 'unquote)
  2134. X                (eq? (car exp) 'unquote-splicing))
  2135. X                (set! qq-lev (-1+ qq-lev))
  2136. X                (let ((qq-val
  2137. X                   (if (= qq-lev 0) ; min val 
  2138. X                       ; --> outermost level
  2139. X                       (if (eq? (car exp) 'unquote-splicing)
  2140. X                       (cons append-me-sym 
  2141. X                         (%expand-macros (cadr exp)))
  2142. X                       (%expand-macros (cadr exp))) 
  2143. X                       (qq-car-cdr exp))))
  2144. X                 (set! qq-lev (1+ qq-lev))
  2145. X                 qq-val))
  2146. X               (else
  2147. X                (qq-car-cdr exp)))))
  2148. X        )
  2149. X       (let ((expansion (qq l)))
  2150. X        (if check-qq-expansion-flag
  2151. X            (check-qq-expansion expansion)) ; error on failure
  2152. X        expansion))))
  2153. X
  2154. X(define CHECK-QQ-EXPANSION
  2155. X  (lambda (exp)
  2156. X      (cond ((vector? exp)
  2157. X         (check-qq-expansion (vector->list exp)))
  2158. X        ((atom? exp)
  2159. X         #f)
  2160. X        (else
  2161. X         (if (eq? (car exp) append-me-sym)
  2162. X             (error "UNQUOTE-SPLICING in unspliceable position"
  2163. X                (list 'unquote-splicing (cdr exp)))
  2164. X             (or (check-qq-expansion (car exp))
  2165. X             (check-qq-expansion (cdr exp))))))))
  2166. X
  2167. X(define CHECK-QQ-EXPANSION-FLAG #t) ; do checking
  2168. X
  2169. X(define UNQ-EXPANDER
  2170. X  (lambda (l) (error "UNQUOTE outside QUASIQUOTE" l)))
  2171. X
  2172. X(define UNQ-SPL-EXPANDER
  2173. X  (lambda (l) (error "UNQUOTE SPLICING outside QUASIQUOTE" l)))
  2174. X
  2175. X;;; MACROS: must be evaluated with MACRO system in place
  2176. X
  2177. X(compiler-syntax QUASIQUOTE qq-expander)
  2178. X(compiler-syntax UNQUOTE unq-expander)
  2179. X(compiler-syntax UNQUOTE-SPLICING unq-spl-expander)
  2180. X
  2181. X;;; END
  2182. X
  2183. END_OF_FILE
  2184. if test 2744 -ne `wc -c <'qquote.s'`; then
  2185.     echo shar: \"'qquote.s'\" unpacked with wrong size!
  2186. fi
  2187. # end of 'qquote.s'
  2188. fi
  2189. if test -f 'xscheme.ini' -a "${1}" != "-c" ; then 
  2190.   echo shar: Will not clobber existing file \"'xscheme.ini'\"
  2191. else
  2192. echo shar: Extracting \"'xscheme.ini'\" \(1486 characters\)
  2193. sed "s/^X//" >'xscheme.ini' <<'END_OF_FILE'
  2194. X; xscheme.ini - initialization code for XScheme version 0.16
  2195. X
  2196. X(load "macros.s")
  2197. X(load "qquote.s")
  2198. X
  2199. X; this version of EVAL knows about the optional enviroment parameter
  2200. X(define (eval x #!optional env)
  2201. X  ((if (default-object? env)
  2202. X     (compile x)
  2203. X     (compile x env))))
  2204. X
  2205. X(define (autoload-from-file file syms #!optional env)
  2206. X  (map (lambda (sym) (put sym '%autoload file)) syms)
  2207. X  '())
  2208. X  
  2209. X(define (*unbound-handler* sym cont)
  2210. X  (let ((file (get sym '%autoload)))
  2211. X    (if file (load file))
  2212. X    (if (not (bound? sym))
  2213. X      (error "unbound variable" sym))
  2214. X    (cont '())))
  2215. X
  2216. X(define head car)
  2217. X(define (tail x) (force (cdr x)))
  2218. X(define empty-stream? null?)
  2219. X(define the-empty-stream '())
  2220. X
  2221. X(macro cons-stream
  2222. X  (lambda (x)
  2223. X    (list 'cons (cadr x) (list 'delay (caddr x)))))
  2224. X
  2225. X(macro make-environment
  2226. X  (lambda (x)
  2227. X    (append '(let ()) (cdr x) '((the-environment)))))
  2228. X
  2229. X(define initial-user-environment (the-environment))
  2230. X
  2231. X(macro case
  2232. X  (lambda (form)
  2233. X    (let ((test (cadr form))
  2234. X          (sym (gensym)))
  2235. X      `(let ((,sym ,test))
  2236. X         (cond ,@(map (lambda (x)
  2237. X                        (if (eq? (car x) 'else)
  2238. X                          x
  2239. X                          `((memv ,sym ',(car x)) ,@(cdr x))))
  2240. X                      (cddr form)))))))
  2241. X(define writeln
  2242. X    (lambda (#!OPTIONAL ovar . rvar)
  2243. X        (if (not (default-object? ovar))
  2244. X            (begin
  2245. X                (display ovar)
  2246. X                (while (not (null? rvar))
  2247. X                    (display (car rvar))
  2248. X                    (set! rvar (cdr rvar))
  2249. X                    )
  2250. X                ))
  2251. X        (newline)))
  2252. X
  2253. X(load "mystuff.s")
  2254. END_OF_FILE
  2255. if test 1486 -ne `wc -c <'xscheme.ini'`; then
  2256.     echo shar: \"'xscheme.ini'\" unpacked with wrong size!
  2257. fi
  2258. # end of 'xscheme.ini'
  2259. fi
  2260. echo shar: End of archive 1 \(of 7\).
  2261. cp /dev/null ark1isdone
  2262. MISSING=""
  2263. for I in 1 2 3 4 5 6 7 ; do
  2264.     if test ! -f ark${I}isdone ; then
  2265.     MISSING="${MISSING} ${I}"
  2266.     fi
  2267. done
  2268. if test "${MISSING}" = "" ; then
  2269.     echo You have unpacked all 7 archives.
  2270.     rm -f ark[1-9]isdone
  2271. else
  2272.     echo You still need to unpack the following archives:
  2273.     echo "        " ${MISSING}
  2274. fi
  2275. ##  End of shell archive.
  2276. exit 0
  2277. -- 
  2278. Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
  2279. Mail comments to the moderator at <amiga-request@cs.odu.edu>.
  2280. Post requests for sources, and general discussion to comp.sys.amiga.
  2281.